Skip to content

[6.x] Convert date bindings to app timezone in raw SQL dump#14937

Merged
jasonvarga merged 1 commit into
statamic:6.xfrom
marcorieser:fix/raw-sql-date-timezone
Jul 6, 2026
Merged

[6.x] Convert date bindings to app timezone in raw SQL dump#14937
jasonvarga merged 1 commit into
statamic:6.xfrom
marcorieser:fix/raw-sql-date-timezone

Conversation

@marcorieser

@marcorieser marcorieser commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

After passing a Carbon instance with a timezone other than UTC to a where() clause, I was confused as to why the dates in the fake query didn't show the correct time.

This PR fixes toRawSql() / raw SQL dumping so DateTimeInterface bindings (e.g. Carbon instances) are converted to the app timezone before being interpolated into the dumped SQL string. Previously, the raw SQL output could show a date/time in whatever timezone the value happened to be in, which didn't match what's actually sent to the "database".

@jasonvarga jasonvarga merged commit fe9ffe9 into statamic:6.x Jul 6, 2026
21 checks passed
@marcorieser marcorieser deleted the fix/raw-sql-date-timezone branch July 6, 2026 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants